package edu.sctu.jarime.june.day20150614.PictureByte;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * Created by user19 on 2015/6/14.
 */
public class PictureUtil {
    File file=new File("D://lili//ADT-23.0.4.zip");
    File file1=new File("D://lili//ADT-23.0.400000.zip");
    public void piature_byte() throws Exception{
        int count = 0;
        int coumtnumber=0;
        FileInputStream fileInputStream= new FileInputStream(file);
        while ((coumtnumber=fileInputStream.read())!=-1){
            count+=coumtnumber;
        }
        System.out.println(count);
    }

    public void byte_picture()throws Exception{


        int coumtnumber=0;
        byte[] buffer=new byte[2014];
        FileInputStream fileInputStream= new FileInputStream(file);
        FileOutputStream fileOutputStream = new FileOutputStream(file1);
        while ((coumtnumber=fileInputStream.read(buffer))!=-1){

            fileOutputStream.write(buffer,0,coumtnumber);
        }
        fileInputStream.close();
        fileOutputStream.close();

    }
}
